﻿@{
    Layout = "~/Views/Shared/_Index.cshtml";
}
@inject Microsoft.AspNetCore.Hosting.IWebHostEnvironment HostingEnvironment
@section header{
    @BundlerHelper.Render(HostingEnvironment.ContentRootPath, Url.Content("~/shris/js/vue.js"))
    @BundlerHelper.Render(HostingEnvironment.ContentRootPath, Url.Content("~/shris/css/element-index.css"))
    @BundlerHelper.Render(HostingEnvironment.ContentRootPath, Url.Content("~/shris/js/element-index.js"))
    @BundlerHelper.Render(HostingEnvironment.ContentRootPath, Url.Content("~/shris/js/axios.js"))
    @BundlerHelper.Render(HostingEnvironment.ContentRootPath, Url.Content("~/shris/css/ShellManage/shell.css"))
}
    <div class="container-div" id="secondShell-vue">
        <!-- 第一部分：显示孔深测量次数、复位按钮 -->
        <div>
            <el-row style="margin-bottom:15px">
                <el-col :span="4">
                    <div class="grid-content bg-purple-light">
                        <el-button type="warning"
                                   v-on:mousedown.native="writeValue('MainPlcControl','Reset',true)"
                                   v-on:mouseup.native="writeValue('MainPlcControl','Reset',false)">复位</el-button>
                    </div>
                </el-col>
                <el-col :span="6" :offset="14">
                    <span class="myspan">连接状态：</span>
                    <span :class="['mycomLight',{'myTrueActive':deviceStatus}]"></span>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="14" :offset="10">
                    <el-select v-model="transfer_from" placeholder="手动搬运起始区" clearable>
                        <el-option v-for="item in machineList" :key="item.value" :label="item.label" :value="item.value"></el-option>
                    </el-select>
                    <el-select v-model="transfer_to" placeholder="手动搬运目的地" clearable>
                        <el-option v-for="item in machineList" :key="item.value" :label="item.label" :value="item.value"></el-option>
                        <el-option label="线外" value="20"></el-option>
                    </el-select>
                    <el-button type="primary" round v-on:click="transferMateril">确认手动搬运</el-button>
                </el-col>
            </el-row>
        </div>
        <!-- 第二部分：通过表格显示基本信息 -->
        <div style="margin: 10px 0px">
            <el-table :data="partTwo.infoData"
                      style="width: 100%"
                      border
                      :header-cell-style="headerStyle"
                      :cell-style="cellStyle">
                <el-table-column prop="info" fixed="left" label="" align="center">
                </el-table-column>
                <el-table-column prop="lathe_1" label="车床1" align="center">
                    <template slot-scope="scope">
                        <span v-if="typeof scope.row.lathe_1 == 'boolean'"
                              :class="['myRoundLight',{'myTrueActive':scope.row.lathe_1}]"></span>
                        <span v-else>{{scope.row.lathe_1}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="cacheStation_1" label="缓存台1" align="center">
                    <template slot-scope="scope">
                        <span v-if="typeof scope.row.cacheStation_1 == 'boolean'"
                              :class="['myRoundLight',{'myTrueActive':scope.row.cacheStation_1}]"></span>
                        <span v-else>{{scope.row.cacheStation_1}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="cacheStation_2" label="缓存台2" align="center">
                    <template slot-scope="scope">
                        <span v-if="typeof scope.row.cacheStation_2 == 'boolean'"
                              :class="['myRoundLight',{'myTrueActive':scope.row.cacheStation_2}]"></span>
                        <span v-else>{{scope.row.cacheStation_2}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="lathe_2" label="车床2" align="center">
                    <template slot-scope="scope">
                        <span v-if="typeof scope.row.lathe_2 == 'boolean'"
                              :class="['myRoundLight',{'myTrueActive':scope.row.lathe_2}]"></span>
                        <span v-else>{{scope.row.lathe_2}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="cacheStation_3" label="缓存台3" align="center">
                    <template slot-scope="scope">
                        <span v-if="typeof scope.row.cacheStation_3 == 'boolean'"
                              :class="['myRoundLight',{'myTrueActive':scope.row.cacheStation_3}]"></span>
                        <span v-else>{{scope.row.cacheStation_3}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="cacheStation_4" label="缓存台4" align="center">
                    <template slot-scope="scope">
                        <span v-if="typeof scope.row.cacheStation_4 == 'boolean'"
                              :class="['myRoundLight',{'myTrueActive':scope.row.cacheStation_4}]"></span>
                        <span v-else>{{scope.row.cacheStation_4}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="lathe_3" label="车床3" align="center">
                    <template slot-scope="scope">
                        <span v-if="typeof scope.row.lathe_3 == 'boolean'"
                              :class="['myRoundLight',{'myTrueActive':scope.row.lathe_3}]"></span>
                        <span v-else>{{scope.row.lathe_3}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="cacheStation_5" label="缓存台5" align="center">
                    <template slot-scope="scope">
                        <span v-if="typeof scope.row.cacheStation_5 == 'boolean'"
                              :class="['myRoundLight',{'myTrueActive':scope.row.cacheStation_5}]"></span>
                        <span v-else>{{scope.row.cacheStation_5}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="cacheStation_6" label="缓存台6" align="center">
                    <template slot-scope="scope">
                        <span v-if="typeof scope.row.cacheStation_6 == 'boolean'"
                              :class="['myRoundLight',{'myTrueActive':scope.row.cacheStation_6}]"></span>
                        <span v-else>{{scope.row.cacheStation_6}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="cacheStation_6" label="清洗机" align="center">
                    <template slot-scope="scope">
                        <span v-if="typeof scope.row.WashMachine == 'boolean'"
                              :class="['myRoundLight',{'myTrueActive':scope.row.WashMachine}]"></span>
                        <span v-else>{{scope.row.WashMachine}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="cacheStation_6" label="三坐标测量" align="center">
                    <template slot-scope="scope">
                        <span v-if="typeof scope.row.ThreeCoordinatesMeasure == 'boolean'"
                              :class="['myRoundLight',{'myTrueActive':scope.row.ThreeCoordinatesMeasure}]"></span>
                        <span v-else>{{scope.row.ThreeCoordinatesMeasure}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="laserMark" label="激光打标" align="center">
                    <template slot-scope="scope">
                        <span v-if="typeof scope.row.laserMark == 'boolean'"
                              :class="['myRoundLight',{'myTrueActive':scope.row.laserMark}]"></span>
                        <span v-else>{{scope.row.laserMark}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="manipulator" label="机械手" align="center">
                    <template slot-scope="scope">
                        <span v-if="typeof scope.row.manipulator == 'boolean'"
                              :class="['myRoundLight',{'myTrueActive':scope.row.manipulator}]"></span>
                        <span v-else>{{scope.row.manipulator}}</span>
                    </template>
                </el-table-column>
            </el-table>
        </div>
        <!-- 第三部分：操作区一-->
        <div style="margin: 20px 0px">
            <el-row :gutter="20">
                <el-col :span="12">
                    <div class="grid-content bg-purple">
                        <el-table :data="partThree.infoData"
                                  style="width: 100%"
                                  border
                                  :header-cell-style="headerStyle"
                                  :cell-style="cellStyle">
                            <el-table-column prop="info" fixed="left" label="" align="center">
                            </el-table-column>
                            <el-table-column prop="loadCar_1" label="上料车1" align="center">
                                <template slot-scope="scope">
                                    <span v-if="typeof scope.row.loadCar_1 == 'boolean'"
                                          :class="['myRoundLight',{'myTrueActive':scope.row.loadCar_1}]"></span>
                                    <span v-else>{{scope.row.loadCar_1}}</span>
                                </template>
                            </el-table-column>
                            <el-table-column prop="loadCar_2" label="上料车2" align="center">
                                <template slot-scope="scope">
                                    <span v-if="typeof scope.row.loadCar_2 == 'boolean'"
                                          :class="['myRoundLight',{'myTrueActive':scope.row.loadCar_2}]"></span>
                                    <span v-else>{{scope.row.loadCar_2}}</span>
                                </template>
                            </el-table-column>
                            <el-table-column prop="completeCar_1"
                                             label="成品车1"
                                             align="center">
                                <template slot-scope="scope">
                                    <span v-if="typeof scope.row.completeCar_1 == 'boolean'"
                                          :class="['myRoundLight',{'myTrueActive':scope.row.completeCar_1}]"></span>
                                    <span v-else>{{scope.row.completeCar_1}}</span>
                                </template>
                            </el-table-column>
                            <el-table-column prop="completeCar_2"
                                             label="成品车2"
                                             align="center">
                                <template slot-scope="scope">
                                    <span v-if="typeof scope.row.completeCar_2 == 'boolean'"
                                          :class="['myRoundLight',{'myTrueActive':scope.row.completeCar_2}]"></span>
                                    <span v-else>{{scope.row.completeCar_2}}</span>
                                </template>
                            </el-table-column>
                            <el-table-column prop="rejectCar" label="不良品车" align="center">
                                <template slot-scope="scope">
                                    <span v-if="typeof scope.row.rejectCar == 'boolean'"
                                          :class="['myRoundLight',{'myTrueActive':scope.row.rejectCar}]"></span>
                                    <span v-else>{{scope.row.rejectCar}}</span>
                                </template>
                            </el-table-column>
                        </el-table>
                        <el-row style="margin: 5px 0px">
                            <el-col :span="8">
                                <el-button type="primary"
                                           v-on:mousedown.native="writeValue('LoadCar01','Loading',true)"
                                           v-on:mouseup.native="writeValue('LoadCar01','Loading',false)">车1上料</el-button>
                            </el-col>
                            <el-col :span="8">
                                <el-button type="primary"
                                           v-on:mousedown.native="writeValue('DownCar01','Downing',true)"
                                           v-on:mouseup.native="writeValue('DownCar01','Downing',false)">车1下料</el-button>
                            </el-col>
                            <el-col :span="8">
                                <el-button type="primary"
                                           v-on:mousedown.native="writeValue('NgCar','Downing',true)"
                                           v-on:mouseup.native="writeValue('NgCar','Downing',false)">MG下料</el-button>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="8">
                                <el-button type="primary"
                                           v-on:mousedown.native="writeValue('LoadCar02','Loading',true)"
                                           v-on:mouseup.native="writeValue('LoadCar02','Loading',false)">车2上料</el-button>
                            </el-col>
                            <el-col :span="8">
                                <el-button type="primary"
                                           v-on:mousedown.native="writeValue('DownCar02','Downing',true)"
                                           v-on:mouseup.native="writeValue('DownCar02','Downing',false)">车2下料</el-button>
                            </el-col>
                            <el-col :span="8">
                                <el-button type="primary"
                                           v-on:click="setCarCount_drawer=true">料车数量设置</el-button>
                            </el-col>
                        </el-row>
                    </div>
                </el-col>
                <el-col :span="6">
                    <div class="grid-content bg-purple-light">
                        <el-card>
                            <div slot="header">扫码器</div>
                            <div>
                                <el-button :type="partThree.StartScanCodeStatus == true ? 'success' : 'info'"
                                           v-on:mousedown.native="writeValue('Scanner','StartScanCode',true)"
                                           v-on:mouseup.native="writeValue('Scanner','StartScanCode',false)">开始扫码</el-button>
                                <div style="text-align: center; margin-top: 5px">
                                    <el-input v-model="partThree.scanCode" :disabled="true">
                                    </el-input>
                                </div>
                                <div>
                                    <span :class="['defualGreen',{'myTrueActiveRed':partThree.comInfo}]"
                                          style="width: 100%;margin: 5px 0px;">通讯正常</span>
                                </div>
                                <el-row>
                                    <el-col :span="12">
                                        <el-button :type="partThree.AgainStatus == true ? 'success' : 'info'"
                                                   v-on:mousedown.native="writeValue('Scanner','Again',true)"
                                                   v-on:mouseup.native="writeValue('Scanner','Again',false)">Again</el-button>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-button :type="partThree.PassStatus == true ? 'success' : 'info'"
                                                   v-on:mousedown.native="writeValue('Scanner','Pass',true)"
                                                   v-on:mouseup.native="writeValue('Scanner','Pass',false)">Pass</el-button>
                                    </el-col>
                                </el-row>
                                <div style="text-align: center; margin-top: 5px">
                                    <el-input v-model="partThree.scanCode_enter" clearable> </el-input>
                                </div>
                            </div>
                        </el-card>
                    </div>
                </el-col>
                <el-col :span="6">
                    <div class="grid-content bg-purple">
                        <el-card>
                            <div slot="header">激光打码</div>
                            <div>
                                <el-row>
                                    <el-col :span="12">
                                        <el-button :type="partThree.laserMark_InitStatus == true ? 'success' : 'info'"
                                                   v-on:mousedown.native="writeValue('LaserMark','Init',true)"
                                                   v-on:mouseup.native="writeValue('LaserMark','Init',false)">初始化</el-button>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-button :type="partThree.laserMark_StartMarkStatus == true ? 'success' : 'info'"
                                                   v-on:mousedown.native="writeValue('LaserMark','StartMark',true)"
                                                   v-on:mouseup.native="writeValue('LaserMark','StartMark',false)">开始打标</el-button>
                                    </el-col>
                                </el-row>
                            </div>
                            <div style="margin-top: 5px">
                                <el-input v-model="partThree.laserMarkInp" clearable>
                                </el-input>
                            </div>
                            <div>
                                <span :class="['defualGreen',{'myTrueActiveRed':partThree.laserMark_com}]"
                                      style="width: 100%; margin: 7px 0px;">通讯正常</span>
                            </div>
                            <div>
                                <span :class="['lineModeStatus',{'myTrueActive':partThree.laserMark_InitSuccess}]" style="width: 100%;margin: 9px 0px;">初始化成功</span>
                            </div>
                            <div>
                                <span :class="['lineModeStatus',{'myTrueActive':partThree.laserMark_markComplete}]" style="width: 100%;margin: 7px 0px;">打标完成</span>
                            </div>
                        </el-card>
                    </div>
                </el-col>
            </el-row>
        </div>
        <!-- 第四部分：操作区二-->
        <div style="margin: 30px 0px">
            <el-row :gutter="20">
                <el-col :span="8">
                    <div class="grid-content bg-purple">
                        <el-row :gutter="5">
                            <el-col :span="8">
                                <el-button :type="partFour.statusGroup1.ManualStatus == true ? 'success' : 'info'" round
                                           v-on:click="writeValue('MainPlcControl','Manual',!partFour.statusGroup1.ManualStatus)">手动模式</el-button>
                            </el-col>
                            <el-col :span="8">
                                <el-button :type="partFour.statusGroup1.AutoStatus == true ? 'success' : 'info'" round
                                           v-on:click="writeValue('MainPlcControl','Auto',!partFour.statusGroup1.AutoStatus)">自动模式</el-button>
                            </el-col>
                            <el-col :span="8">
                                <el-button :type="partFour.statusGroup1.FirstpieceStatus == true ? 'success' : 'info'" round
                                           v-on:click="writeValue('MainPlcControl','FirstPiece',!partFour.statusGroup1.FirstpieceStatus)">首件模式</el-button>
                            </el-col>
                        </el-row>
                        <el-row :gutter="5" style="margin: 30px 0px">
                            <el-col :span="8">
                                <el-button :type="partFour.statusGroup1.AutoReadyStatus == true ? 'success' : 'info'" round>自动准备</el-button>
                            </el-col>
                            <el-col :span="8">
                                <el-button :type="partFour.statusGroup1.AutoRunStatus == true ? 'success' : 'info'" round
                                           v-on:mousedown.native="writeValue('MainPlcControl','Start',true)"
                                           v-on:mouseup.native="writeValue('MainPlcControl','Start',false)">启动</el-button>
                            </el-col>
                            <el-col :span="8">
                                <el-button :type="partFour.statusGroup1.AutoStopStatus == true ? 'danger' : 'info'" round
                                           v-on:mousedown.native="writeValue('MainPlcControl','Stop',true)"
                                           v-on:mouseup.native="writeValue('MainPlcControl','Stop',false)">停止</el-button>
                            </el-col>
                        </el-row>
                        <el-row :gutter="5">
                            <el-col :span="8">
                                <el-button :type="partFour.statusGroup1.RobotRestart == true ? 'success' : 'info'" round
                                           v-on:mousedown.native="writeValue('Manipulator','RobotRestart',true)"
                                           v-on:mouseup.native="writeValue('Manipulator','RobotRestart',false)">机器人重新开始</el-button>
                            </el-col>
                            <el-col :span="8">
                                <el-button :type="partFour.statusGroup1.AllRestartStatus == true ? 'success' : 'info'" round
                                           v-on:mousedown.native="writeValue('MainPlcControl','AllRestart',true)"
                                           v-on:mouseup.native="writeValue('MainPlcControl','AllRestart',false)">全线重新开始</el-button>
                            </el-col>
                            <el-col :span="8">
                                <el-button :type="partFour.statusGroup1.SuspendStatus == true ? 'success' : 'info'" round
                                           v-on:click="writeValue('MainPlcControl','Suspend',!partFour.statusGroup1.SuspendStatus)">运行暂停</el-button>
                            </el-col>
                        </el-row>
                    </div>
                </el-col>
                <el-col :span="8">
                    <div class="grid-content bg-purple-light">
                        <el-row :gutter="5">
                            <el-col :span="8">
                                <el-button :type="partFour.statusGroup2.lathe_01_BypassStatus == true ? 'success' : 'info'" round
                                           v-on:click="writeValue('MainPlcControl','Bypass_01',!partFour.statusGroup2.lathe_01_BypassStatus)">车床1Bypass</el-button>
                            </el-col>
                            <el-col :span="8">
                                <el-button :type="partFour.statusGroup2.lathe_02_BypassStatus == true ? 'success' : 'info'" round
                                           v-on:click="writeValue('MainPlcControl','Bypass_02',!partFour.statusGroup2.lathe_02_BypassStatus)">车床2Bypass</el-button>
                            </el-col>
                            <el-col :span="8">
                                <el-button :type="partFour.statusGroup2.lathe_03_BypassStatus == true ? 'success' : 'info'" round
                                           v-on:click="writeValue('MainPlcControl','Bypass_03',!partFour.statusGroup2.lathe_03_BypassStatus)">车床3Bypass</el-button>
                            </el-col>
                        </el-row>
                        <el-row :gutter="5" style="margin: 30px 0px">
                            <el-col :span="8">
                                <el-button :type="partFour.statusGroup2.scannerBypassStatus == true ? 'success' : 'info'" round
                                           v-on:click="writeValue('Scanner','ScanCodeBypass',!partFour.statusGroup2.scannerBypassStatus)">扫码Bypass</el-button>
                            </el-col>
                            <el-col :span="8">
                                <el-button :type="partFour.statusGroup2.laserMark_CodeBypassStatus == true ? 'success' : 'info'" round
                                           v-on:click="writeValue('LaserMark','CodeBypass',!partFour.statusGroup2.laserMark_CodeBypassStatus)">打码Bypass</el-button>
                            </el-col>
                        </el-row>
                        <el-row :gutter="5">
                            <el-col :span="8">
                                <el-button :type="partFour.statusGroup2.WashMachineBypassStatus == true ? 'success' : 'info'" round
                                           v-on:click="writeValue('WashMachine','Bypass',!partFour.statusGroup2.WashMachineBypassStatus)">清洗机Bypass</el-button>
                            </el-col>
                            <el-col :span="8">
                                <el-button :type="partFour.statusGroup2.ThreeCoordinatesMeasureBypassStatus == true ? 'success' : 'info'" round
                                           v-on:click="writeValue('ThreeCoordinatesMeasure','Bypass',!partFour.statusGroup2.ThreeCoordinatesMeasureBypassStatus)">三坐标测量Bypass</el-button>
                            </el-col>
                        </el-row>
                    </div>
                </el-col>
                <el-col :span="8">
                    <div class="grid-content bg-purple">
                        <el-card>
                            <div slot="header">机器手抓放位置</div>
                            <div>
                                <el-row :gutter="5">
                                    <el-col :span="4"><label for="">抓取：</label></el-col>
                                    <el-col :span="10">
                                        <el-input v-model="partThree.manipulator_Source1"
                                                  disabled></el-input>
                                    </el-col>
                                    <el-col :span="10">
                                        <el-input v-model="partThree.manipulator_Source2"
                                                  disabled></el-input>
                                    </el-col>
                                </el-row>
                            </div>
                            <div style="margin: 10px 0px">
                                <el-row :gutter="5">
                                    <el-col :span="4">
                                        <label for="">放置：</label>
                                    </el-col>
                                    <el-col :span="10">
                                        <el-input v-model="partThree.manipulator_Target1"
                                                  disabled></el-input>
                                    </el-col>
                                    <el-col :span="10">
                                        <el-input v-model="partThree.manipulator_Target2"
                                                  disabled></el-input>
                                    </el-col>
                                </el-row>
                            </div>
                            <div>
                                <el-row :gutter="5">
                                    <el-col :span="4">
                                        <label for="">位置：</label>
                                    </el-col>
                                    <el-col :span="10">
                                        <el-input v-model="partThree.manipulator_Address"
                                                  disabled></el-input>
                                    </el-col>
                                    <el-col :span="10"></el-col>
                                </el-row>
                            </div>
                        </el-card>
                    </div>
                </el-col>
            </el-row>
        </div>
        <!-- 第五部分：隐藏区-->
        <div>
            <el-drawer title="设置料车数量" :visible.sync="setCarCount_drawer" direction="rtl">
                <el-table style="width: 100%" border
                          :data="setCarTable"
                          :header-cell-style="headerStyle"
                          :cell-style="cellStyle">
                    <el-table-column prop="info" fixed="left" label="" align="center">
                    </el-table-column>
                    <el-table-column prop="currentNum" label="当前数量" align="center">
                    </el-table-column>
                    <el-table-column prop="setNum" label="设置数量" align="center">
                        <template slot-scope="scope">
                            <el-input v-model="scope.row.setNum"></el-input>
                        </template>
                    </el-table-column>
                    <el-table-column label="操作" align="center">
                        <template slot-scope="scope">
                            <el-button type="info" v-on:click="setCarNum(scope.row)">设置</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </el-drawer>
        </div>
    </div>

<script>
    let app = new Vue({
        el: "#secondShell-vue",
        data: {
            partOne: {
            },
            partTwo: {
                infoData: [
                    {
                        info: "急停",
                        lathe_1: false,
                        cacheStation_1: null,
                        cacheStation_2: null,
                        lathe_2: false,
                        cacheStation_3: null,
                        cacheStation_4: null,
                        lathe_3: false,
                        cacheStation_5: null,
                        cacheStation_6: null,
                        WashMachine: false,
                        ThreeCoordinatesMeasure:false,
                        laserMark: false,
                        manipulator: false,
                    },
                    {
                        info: "准备",
                        lathe_1: false,
                        cacheStation_1: null,
                        cacheStation_2: null,
                        lathe_2: false,
                        cacheStation_3: null,
                        cacheStation_4: null,
                        lathe_3: false,
                        cacheStation_5: null,
                        cacheStation_6: null,
                        WashMachine: false,
                        ThreeCoordinatesMeasure: false,
                        laserMark: false,
                        manipulator: false,
                    },
                    {
                        info: "结束",
                        lathe_1: false,
                        cacheStation_1: null,
                        cacheStation_2: null,
                        lathe_2: false,
                        cacheStation_3: null,
                        cacheStation_4: null,
                        lathe_3: false,
                        cacheStation_5: null,
                        cacheStation_6: null,
                        WashMachine: false,
                        ThreeCoordinatesMeasure: false,
                        laserMark: false,
                        manipulator: null,
                    },
                    {
                        info: "有工件",
                        lathe_1: false,
                        cacheStation_1: false,
                        cacheStation_2: false,
                        lathe_2: false,
                        cacheStation_3: false,
                        cacheStation_4: false,
                        lathe_3: false,
                        cacheStation_5: false,
                        cacheStation_6: false,
                        WashMachine: false,
                        ThreeCoordinatesMeasure: false,
                        laserMark: false,
                        manipulator: false,
                    },
                    {
                        info: "工件来源",
                        lathe_1: '未知',
                        cacheStation_1: '未知',
                        cacheStation_2: '未知',
                        lathe_2: '未知',
                        cacheStation_3: '未知',
                        cacheStation_4: '未知',
                        lathe_3: '未知',
                        cacheStation_5: '未知',
                        cacheStation_6: '未知',
                        WashMachine: '未知',
                        ThreeCoordinatesMeasure: '未知',
                        laserMark: '未知',
                        manipulator: '未知',
                    },
                ],
            },
            partThree: {
                infoData: [
                    {
                        info: "在位",
                        loadCar_1: false,
                        loadCar_2: false,
                        completeCar_1: false,
                        completeCar_2: false,
                        rejectCar: false,
                    },
                    {
                        info: "料车空",
                        loadCar_1: false,
                        loadCar_2: false,
                        completeCar_1: null,
                        completeCar_2: null,
                        rejectCar: null,
                    },
                    {
                        info: "料车满",
                        loadCar_1: null,
                        loadCar_2: null,
                        completeCar_1: false,
                        completeCar_2: false,
                        rejectCar: false,
                    },
                    {
                        info: "工件数量",
                        loadCar_1: 0,
                        loadCar_2: 0,
                        completeCar_1: 0,
                        completeCar_2: 0,
                        rejectCar: 0,
                    },
                ],
                StartScanCodeStatus: false,
                scanCode: "",
                scanCode_enter: null,
                comInfo: false,
                AgainStatus: false,
                PassStatus: false,
                laserMarkInp: "",
                laserMark_com: false,
                laserMark_InitStatus: false,
                laserMark_StartMarkStatus: false,
                laserMark_InitSuccess: false,
                laserMark_markComplete: false,
                manipulator_Source1: "上料车NO1",
                manipulator_Source2: "车床1",
                manipulator_Target1: "成品车NO1",
                manipulator_Target2: "车床1",
                manipulator_Address: "车床1",
            },
            partFour: {
                statusGroup1: {
                    OrderControlMode: false,
                    ManualStatus: false,
                    AutoStatus: false,
                    FirstpieceStatus: false,
                    AutoReadyStatus: false,
                    AutoRunStatus: false,
                    AutoStopStatus: false,
                    AllRestartStatus: false,
                    SuspendStatus: false,
                    RobotRestart: false
                },
                statusGroup2: {
                    WashMachineBypassStatus: false,
                    ThreeCoordinatesMeasureBypassStatus: false,
                    lathe_01_BypassStatus: false,
                    lathe_02_BypassStatus: false,
                    lathe_03_BypassStatus: false,
                    scannerBypassStatus: false,
                    laserMark_CodeBypassStatus: false
                }
            },
            // 手动搬运工件
            machineList: [
                {
                    label: '车床1',
                    value: 1
                },
                {
                    label: '缓存台1',
                    value: 2
                },
                {
                    label: '缓存台2',
                    value: 3
                },
                {
                    label: '车床2',
                    value: 4
                },
                {
                    label: '缓存台3',
                    value: 5
                },
                {
                    label: '缓存台4',
                    value: 6
                },
                {
                    label: '车床3',
                    value: 7
                },
                {
                    label: '缓存台5',
                    value: 8
                },
                {
                    label: '缓存台6',
                    value: 9
                },
                {
                    label: '三坐标测量',
                    value: 10
                },
                {
                    label: '扫码区',
                    value: 11
                },
                {
                    label: '打码区',
                    value: 12
                },
                {
                    label: '清洗机',
                    value: 13
                }
            ],
            transfer_from: '',
            transfer_to: '',
            setCarCount_drawer: false,
            deviceStatus: false,
            // 料车数量设置表格
            setCarTable: [
                {
                    info: '上料车01',
                    currentNum: 0,
                    setNum: 20
                },
                {
                    info: '上料车02',
                    currentNum: 0,
                    setNum: 20
                },
                {
                    info: '下料车01',
                    currentNum: 0,
                    setNum: 20
                },
                {
                    info: '下料车02',
                    currentNum: 0,
                    setNum: 20
                },
                {
                    info: 'NG料车',
                    currentNum: 0,
                    setNum: 20
                }
            ]
        },
        methods: {
            // 复位按钮按下
            resetEnter() {
                this.$notify({
                    title: "success",
                    message: "复位按钮按下",
                    type: "success",
                });
            },
            // 表头样式设置
            headerStyle(obj) {
                return {
                    "background-color": "rgb(153,204,255)",
                };
            },
            // 单元格样式设置
            cellStyle(obj) {
                if (obj.columnIndex == 0) {
                    return {
                        "background-color": "rgb(204,255,204)",
                        "font-weight": 700,
                    };
                }
            },
            // 初始化数据
            initData() {
                let url = '@Url.Content("~/ShellManage/ShellBasic/GetInitData")'
                axios.get(url).then(res => {
                    let data = res.data;
                    this.DataFactory(data)
                }).catch(err => {
                    console.log(err);
                })
            },
            // 跟踪数据
            trackData() {
                setInterval(() => {
                    let url = '@Url.Content("~/ShellManage/ShellBasic/GetTrackData")'
                    axios.get(url).then(res => {
                        let data = res.data;
                        this.DataFactory(data)
                    }).catch(err => {
                        console.log(err);
                    })
                }, 1000)
            },
            // 写数据
            writeValue(deviceCode, dataName, Value) {
                if (dataName == 'StartScanCode' || dataName == 'StartMark') {
                    let url = '@Url.Content("~/ShellManage/ShellBasic/WriteValue")'
                    let command = 'StartMark';
                    let value = this.partThree.laserMarkInp;
                    if (dataName == 'StartScanCode') {
                        command = 'StartScanCode';
                        let value = this.partThree.scanCode_enter;
                    }
                    axios.get(url, {
                        params: {
                            command: command,
                            value:value
                        }
                    }).then(res => {
                        if (res.data.result != true) {
                            this.$message({
                                showClose: true,
                                duration: 2500,
                                message: '错误！！！与PLC交互：' + res.data.msg,
                                type: 'error',
                                offset: 80
                            })
                        }
                    }).catch(err => {
                        this.$message({
                            showClose: true,
                            duration: 2500,
                            message: '错误！！！与PLC交互：' + err,
                            type: 'error',
                            offset: 80
                        })
                    })
                }
                let url = '@Url.Content("~/ShellManage/ShellBasic/WriteValue")'
                axios.get(url, {
                    params: {
                        deviceCode: deviceCode,
                        dataName: dataName,
                        Value: Value
                    }
                }).then(res => {
                    if (res.data.result != true) {
                        this.$message({
                            showClose: true,
                            duration: 2500,
                            message: '错误！！！与PLC交互失败：' + res.data.result.msg,
                            type: 'error',
                            offset: 80
                        })
                    }
                }).catch(err => {
                    this.$message({
                        showClose: true,
                        duration: 2500,
                        message: '错误！！！与PLC交互：' + err,
                        type: 'error',
                        offset: 80
                    })
                })
            },
            // 处理数据
            DataFactory(data) {
                if (data.mainPlcStatus != null) {
                    if (this.partFour.statusGroup1.OrderControlMode != data.mainPlcStatus.OrderControlMode) {
                        this.partFour.statusGroup1.OrderControlMode = data.mainPlcStatus.OrderControlMode
                    }
                    if (this.partFour.statusGroup1.ManualStatus != data.mainPlcStatus.ManualStatus) {
                        this.partFour.statusGroup1.ManualStatus = data.mainPlcStatus.ManualStatus
                    }
                    if (this.partFour.statusGroup1.AutoStatus != data.mainPlcStatus.AutoStatus) {
                        this.partFour.statusGroup1.AutoStatus = data.mainPlcStatus.AutoStatus
                    }
                    if (this.partFour.statusGroup1.FirstpieceStatus != data.mainPlcStatus.FirstpieceStatus) {
                        this.partFour.statusGroup1.FirstpieceStatus = data.mainPlcStatus.FirstpieceStatus
                    }
                    if (this.partFour.statusGroup1.AutoReadyStatus != data.mainPlcStatus.AutoReadyStatus) {
                        this.partFour.statusGroup1.AutoReadyStatus = data.mainPlcStatus.AutoReadyStatus
                    }
                    if (this.partFour.statusGroup1.AutoRunStatus != data.mainPlcStatus.AutoRunStatus) {
                        this.partFour.statusGroup1.AutoRunStatus = data.mainPlcStatus.AutoRunStatus
                    }
                    if (this.partFour.statusGroup1.AutoStopStatus != data.mainPlcStatus.AutoStopStatus) {
                        this.partFour.statusGroup1.AutoStopStatus = data.mainPlcStatus.AutoStopStatus
                    }
                    if (this.partFour.statusGroup1.AllRestartStatus != data.mainPlcStatus.AllRestartStatus) {
                        this.partFour.statusGroup1.AllRestartStatus = data.mainPlcStatus.AllRestartStatus
                    }
                    if (this.partFour.statusGroup1.SuspendStatus != data.mainPlcStatus.SuspendStatus) {
                        this.partFour.statusGroup1.SuspendStatus = data.mainPlcStatus.SuspendStatus
                    }
                    if (this.partTwo.infoData[0].lathe_1 != data.mainPlcStatus.EMO_01) {
                        this.partTwo.infoData[0].lathe_1 = data.mainPlcStatus.EMO_01;
                    }
                    if (this.partTwo.infoData[1].lathe_1 != data.mainPlcStatus.Ready_01) {
                        this.partTwo.infoData[1].lathe_1 = data.mainPlcStatus.Ready_01;
                    }
                    if (this.partTwo.infoData[2].lathe_1 != data.mainPlcStatus.End_01) {
                        this.partTwo.infoData[2].lathe_1 = data.mainPlcStatus.End_01;
                    }
                    if (this.partTwo.infoData[3].lathe_1 != data.mainPlcStatus.HasWorkpiece_01) {
                        this.partTwo.infoData[3].lathe_1 = data.mainPlcStatus.HasWorkpiece_01;
                    }
                    let result1 = this.getDataDefind("工件来源", data.mainPlcStatus.WorkpieceSource_01);
                    if (this.partTwo.infoData[4].lathe_1 != result1) {
                        this.partTwo.infoData[4].lathe_1 = result1;
                    }
                    if (this.partFour.statusGroup2.lathe_01_BypassStatus != data.mainPlcStatus.BypassStatus_01) {
                        this.partFour.statusGroup2.lathe_01_BypassStatus = data.mainPlcStatus.BypassStatus_01
                    }
                    if (this.partTwo.infoData[0].lathe_2 != data.mainPlcStatus.EMO_02) {
                        this.partTwo.infoData[0].lathe_2 = data.mainPlcStatus.EMO_02;
                    }
                    if (this.partTwo.infoData[1].lathe_2 != data.mainPlcStatus.Ready_02) {
                        this.partTwo.infoData[1].lathe_2 = data.mainPlcStatus.Ready_02;
                    }
                    if (this.partTwo.infoData[2].lathe_2 != data.mainPlcStatus.End_02) {
                        this.partTwo.infoData[2].lathe_2 = data.mainPlcStatus.End_02;
                    }
                    if (this.partTwo.infoData[3].lathe_2 != data.mainPlcStatus.HasWorkpiece_02) {
                        this.partTwo.infoData[3].lathe_2 = data.mainPlcStatus.HasWorkpiece_02;
                    }
                    let result2 = this.getDataDefind("工件来源", data.mainPlcStatus.WorkpieceSource_02);
                    if (this.partTwo.infoData[4].lathe_2 != result2) {
                        this.partTwo.infoData[4].lathe_2 = result2;
                    }
                    if (this.partFour.statusGroup2.lathe_02_BypassStatus != data.mainPlcStatus.BypassStatus_02) {
                        this.partFour.statusGroup2.lathe_02_BypassStatus = data.mainPlcStatus.BypassStatus_02
                    }
                    if (this.partTwo.infoData[0].lathe_3 != data.mainPlcStatus.EMO_03) {
                        this.partTwo.infoData[0].lathe_3 = data.mainPlcStatus.EMO_03;
                    }
                    if (this.partTwo.infoData[1].lathe_3 != data.mainPlcStatus.Ready_03) {
                        this.partTwo.infoData[1].lathe_3 = data.mainPlcStatus.Ready_03;
                    }
                    if (this.partTwo.infoData[2].lathe_3 != data.mainPlcStatus.End_03) {
                        this.partTwo.infoData[2].lathe_3 = data.mainPlcStatus.End_03;
                    }
                    if (this.partTwo.infoData[3].lathe_3 != data.mainPlcStatus.HasWorkpiece_03) {
                        this.partTwo.infoData[3].lathe_3 = data.mainPlcStatus.HasWorkpiece_03;
                    }
                    let result3 = this.getDataDefind("工件来源", data.mainPlcStatus.WorkpieceSource_03);
                    if (this.partTwo.infoData[4].lathe_3 != result3) {
                        this.partTwo.infoData[4].lathe_3 = result3;
                    }
                    if (this.partFour.statusGroup2.lathe_03_BypassStatus != data.mainPlcStatus.BypassStatus_03) {
                        this.partFour.statusGroup2.lathe_03_BypassStatus = data.mainPlcStatus.BypassStatus_03
                    }
                }
                if (data.cacheStation1 != null) {
                    if (this.partTwo.infoData[3].cacheStation_1 != data.cacheStation1.HasWorkpiece) {
                        this.partTwo.infoData[3].cacheStation_1 = data.cacheStation1.HasWorkpiece;
                    }
                    let result = this.getDataDefind("工件来源", data.cacheStation1.WorkpieceSource);
                    if (this.partTwo.infoData[4].cacheStation_1 != result) {
                        this.partTwo.infoData[4].cacheStation_1 = result;
                    }
                }
                if (data.cacheStation2 != null) {
                    if (this.partTwo.infoData[3].cacheStation_2 != data.cacheStation2.HasWorkpiece) {
                        this.partTwo.infoData[3].cacheStation_2 = data.cacheStation2.HasWorkpiece;
                    }
                    let result = this.getDataDefind("工件来源", data.cacheStation2.WorkpieceSource);
                    if (this.partTwo.infoData[4].cacheStation_2 != result) {
                        this.partTwo.infoData[4].cacheStation_2 = result;
                    }
                }
                if (data.cacheStation3 != null) {
                    if (this.partTwo.infoData[3].cacheStation_3 != data.cacheStation3.HasWorkpiece) {
                        this.partTwo.infoData[3].cacheStation_3 = data.cacheStation3.HasWorkpiece;
                    }
                    let result = this.getDataDefind("工件来源", data.cacheStation3.WorkpieceSource);
                    if (this.partTwo.infoData[4].cacheStation_3 != result) {
                        this.partTwo.infoData[4].cacheStation_3 = result;
                    }
                }
                if (data.cacheStation4 != null) {
                    if (this.partTwo.infoData[3].cacheStation_4 != data.cacheStation4.HasWorkpiece) {
                        this.partTwo.infoData[3].cacheStation_4 = data.cacheStation4.HasWorkpiece;
                    }
                    let result = this.getDataDefind("工件来源", data.cacheStation4.WorkpieceSource);
                    if (this.partTwo.infoData[4].cacheStation_4 != result) {
                        this.partTwo.infoData[4].cacheStation_4 = result;
                    }
                }
                if (data.cacheStation5 != null) {
                    if (this.partTwo.infoData[3].cacheStation_5 != data.cacheStation5.HasWorkpiece) {
                        this.partTwo.infoData[3].cacheStation_5 = data.cacheStation5.HasWorkpiece;
                    }
                    let result = this.getDataDefind("工件来源", data.cacheStation5.WorkpieceSource);
                    if (this.partTwo.infoData[4].cacheStation_5 != result) {
                        this.partTwo.infoData[4].cacheStation_5 = result;
                    }
                }
                if (data.cacheStation6 != null) {
                    if (this.partTwo.infoData[3].cacheStation_6 != data.cacheStation6.HasWorkpiece) {
                        this.partTwo.infoData[3].cacheStation_6 = data.cacheStation6.HasWorkpiece;
                    }
                    let result = this.getDataDefind("工件来源", data.cacheStation6.WorkpieceSource);
                    if (this.partTwo.infoData[4].cacheStation_6 != result) {
                        this.partTwo.infoData[4].cacheStation_6 = result;
                    }
                }
                if (data.WashMachine != null) {
                    if (this.partTwo.infoData[0].WashMachine != data.WashMachine.EMO) {
                        this.partTwo.infoData[0].WashMachine = data.WashMachine.EMO;
                    }
                    if (this.partTwo.infoData[1].WashMachine != data.WashMachine.Ready) {
                        this.partTwo.infoData[1].WashMachine = data.WashMachine.Ready;
                    }
                    if (this.partTwo.infoData[2].WashMachine != data.WashMachine.End) {
                        this.partTwo.infoData[2].WashMachine = data.WashMachine.End;
                    }
                    if (this.partTwo.infoData[3].WashMachine != data.WashMachine.HasWorkpiece) {
                        this.partTwo.infoData[3].WashMachine = data.WashMachine.HasWorkpiece;
                    }
                    let result = this.getDataDefind("工件来源", data.WashMachine.WorkpieceSource);
                    if (this.partTwo.infoData[4].WashMachine != result) {
                        this.partTwo.infoData[4].WashMachine = result;
                    }
                    if (this.partFour.statusGroup2.WashMachineBypassStatus != data.WashMachine.BypassStatus) {
                        this.partFour.statusGroup2.WashMachineBypassStatus = data.WashMachine.BypassStatus
                    }
                }
                if (data.ThreeCoordinatesMeasure != null) {
                    if (this.partTwo.infoData[0].ThreeCoordinatesMeasure != data.ThreeCoordinatesMeasure.EMO) {
                        this.partTwo.infoData[0].ThreeCoordinatesMeasure = data.ThreeCoordinatesMeasure.EMO;
                    }
                    if (this.partTwo.infoData[1].ThreeCoordinatesMeasure != data.ThreeCoordinatesMeasure.Ready) {
                        this.partTwo.infoData[1].ThreeCoordinatesMeasure = data.ThreeCoordinatesMeasure.Ready;
                    }
                    if (this.partTwo.infoData[2].ThreeCoordinatesMeasure != data.ThreeCoordinatesMeasure.End) {
                        this.partTwo.infoData[2].ThreeCoordinatesMeasure = data.ThreeCoordinatesMeasure.End;
                    }
                    if (this.partTwo.infoData[3].ThreeCoordinatesMeasure != data.ThreeCoordinatesMeasure.HasWorkpiece) {
                        this.partTwo.infoData[3].ThreeCoordinatesMeasure = data.ThreeCoordinatesMeasure.HasWorkpiece;
                    }
                    let result = this.getDataDefind("工件来源", data.ThreeCoordinatesMeasure.WorkpieceSource);
                    if (this.partTwo.infoData[4].ThreeCoordinatesMeasure != result) {
                        this.partTwo.infoData[4].ThreeCoordinatesMeasure = result;
                    }
                    if (this.partFour.statusGroup2.ThreeCoordinatesMeasureBypassStatus != data.ThreeCoordinatesMeasure.BypassStatus) {
                        this.partFour.statusGroup2.ThreeCoordinatesMeasureBypassStatus = data.ThreeCoordinatesMeasure.BypassStatus
                    }
                }
                if (data.loadCar1 != null) {
                    if (this.partThree.infoData[0].loadCar_1 != data.loadCar1.AtStation) {
                        this.partThree.infoData[0].loadCar_1 = data.loadCar1.AtStation
                    }
                    if (this.partThree.infoData[1].loadCar_1 != data.loadCar1.Empty) {
                        this.partThree.infoData[1].loadCar_1 = data.loadCar1.Empty
                    }
                    if (this.partThree.infoData[3].loadCar_1 != data.loadCar1.WorkpieceNum) {
                        this.partThree.infoData[3].loadCar_1 = data.loadCar1.WorkpieceNum
                    }
                }
                if (data.loadCar2 != null) {
                    if (this.partThree.infoData[0].loadCar_2 != data.loadCar2.AtStation) {
                        this.partThree.infoData[0].loadCar_2 = data.loadCar2.AtStation
                    }
                    if (this.partThree.infoData[1].loadCar_2 != data.loadCar2.Empty) {
                        this.partThree.infoData[1].loadCar_2= data.loadCar2.Empty
                    }
                    if (this.partThree.infoData[3].loadCar_2 != data.loadCar2.WorkpieceNum) {
                        this.partThree.infoData[3].loadCar_2 = data.loadCar2.WorkpieceNum
                    }
                }
                if (data.downCar1 != null) {
                    if (this.partThree.infoData[0].completeCar_1 != data.downCar1.AtStation) {
                        this.partThree.infoData[0].completeCar_1 = data.downCar1.AtStation
                    }
                    if (this.partThree.infoData[2].completeCar_1 != data.downCar1.Full) {
                        this.partThree.infoData[2].completeCar_1 = data.downCar1.Full
                    }
                    if (this.partThree.infoData[3].completeCar_1 != data.downCar1.WorkpieceNum) {
                        this.partThree.infoData[3].completeCar_1 = data.downCar1.WorkpieceNum
                    }
                }
                if (data.downCar2 != null) {
                    if (this.partThree.infoData[0].completeCar_2 != data.downCar2.AtStation) {
                        this.partThree.infoData[0].completeCar_2 = data.downCar2.AtStation
                    }
                    if (this.partThree.infoData[2].completeCar_2 != data.downCar2.Full) {
                        this.partThree.infoData[2].completeCar_2 = data.downCar2.Full
                    }
                    if (this.partThree.infoData[3].completeCar_2 != data.downCar2.WorkpieceNum) {
                        this.partThree.infoData[3].completeCar_2 = data.downCar2.WorkpieceNum
                    }
                }
                if (data.NGCar != null) {
                    if (this.partThree.infoData[0].rejectCar != data.NGCar.AtStation) {
                        this.partThree.infoData[0].rejectCar = data.NGCar.AtStation
                    }
                    if (this.partThree.infoData[2].rejectCar != data.NGCar.Full) {
                        this.partThree.infoData[2].rejectCar = data.NGCar.Full
                    }
                    if (this.partThree.infoData[3].rejectCar != data.NGCar.WorkpieceNum) {
                        this.partThree.infoData[3].rejectCar = data.NGCar.WorkpieceNum
                    }
                }
                if (data.scanner != null) {
                    if (this.partThree.scanCode != data.scanner.ScanCodeContent) {
                        this.partThree.scanCode = data.scanner.ScanCodeContent
                    }
                    if (this.partThree.comInfo != data.scanner.ScanCodeCom) {
                        this.partThree.comInfo = data.scanner.ScanCodeCom
                    }
                    if (this.partThree.AgainStatus != data.scanner.AgainStatus) {
                        this.partThree.AgainStatus = data.scanner.AgainStatus
                    }
                    if (this.partThree.PassStatus != data.scanner.PassStatus) {
                        this.partThree.PassStatus = data.scanner.PassStatus
                    }
                    if (this.partThree.StartScanCodeStatus != data.scanner.StartScanCodeStatus) {
                        this.partThree.StartScanCodeStatus = data.scanner.StartScanCodeStatus
                    }
                    if (this.partFour.statusGroup2.scannerBypassStatus != data.scanner.ScanCodeBypassStatus) {
                        this.partFour.statusGroup2.scannerBypassStatus = data.scanner.ScanCodeBypassStatus
                    }
                    if (this.partThree.scanCode != data.scanner.ScanCodeContent) {
                        this.partThree.scanCode = data.scanner.ScanCodeContent
                    }
                }
                if (data.laserMark != null) {
                    if (this.partTwo.infoData[0].laserMark != data.laserMark.EMO) {
                        this.partTwo.infoData[0].laserMark = data.laserMark.EMO;
                    }
                    if (this.partTwo.infoData[1].laserMark != data.laserMark.Ready) {
                        this.partTwo.infoData[1].laserMark = data.laserMark.Ready;
                    }
                    if (this.partTwo.infoData[2].laserMark != data.laserMark.End) {
                        this.partTwo.infoData[2].laserMark = data.laserMark.End;
                    }
                    if (this.partTwo.infoData[3].laserMark != data.laserMark.HasWorkpiece) {
                        this.partTwo.infoData[3].laserMark = data.laserMark.HasWorkpiece;
                    }
                    let result = this.getDataDefind("工件来源", data.laserMark.WorkpieceSource);
                    if (this.partTwo.infoData[4].laserMark != result) {
                        this.partTwo.infoData[4].laserMark = result;
                    }
                    if (this.partThree.laserMark_com != data.laserMark.Com) {
                        this.partThree.laserMark_com = data.laserMark.Com
                    }
                    if (this.partThree.laserMark_InitSuccess != data.laserMark.InitSuccess) {
                        this.partThree.laserMark_InitSuccess = data.laserMark.InitSuccess
                    }
                    if (this.partThree.laserMark_markComplete != data.laserMark.MarkComplete) {
                        this.partThree.laserMark_markComplete = data.laserMark.MarkComplete
                    }
                    if (this.partThree.laserMark_InitStatus != data.laserMark.InitStatus) {
                        this.partThree.laserMark_InitStatus = data.laserMark.InitStatus
                    }
                    if (this.partThree.laserMark_StartMarkStatus != data.laserMark.StartMarkStatus) {
                        this.partThree.laserMark_StartMarkStatus = data.laserMark.StartMarkStatus
                    }
                    if (this.partFour.statusGroup2.laserMark_CodeBypassStatus != data.laserMark.CodeBypassStatus) {
                        this.partFour.statusGroup2.laserMark_CodeBypassStatus = data.laserMark.CodeBypassStatus
                    }
                }
                if (data.manipulator != null) {
                    if (this.partTwo.infoData[0].manipulator != data.manipulator.EMO) {
                        this.partTwo.infoData[0].manipulator = data.manipulator.EMO;
                    }
                    if (this.partTwo.infoData[1].manipulator != data.manipulator.Ready) {
                        this.partTwo.infoData[1].manipulator = data.manipulator.Ready;
                    }
                    if (this.partTwo.infoData[3].manipulator != data.manipulator.HasWorkpiece) {
                        this.partTwo.infoData[3].manipulator = data.manipulator.HasWorkpiece;
                    }
                    let result = this.getDataDefind("工件来源", data.manipulator.WorkpieceSource);
                    if (this.partTwo.infoData[4].manipulator != result) {
                        this.partTwo.infoData[4].manipulator = result;
                    }
                    if (this.partThree.manipulator_Source1 != data.manipulator.Grab01) {
                        this.partThree.manipulator_Source1 = data.manipulator.Grab01
                    }
                    if (this.partThree.manipulator_Source2 != data.manipulator.Grab02) {
                        this.partThree.manipulator_Source2 = data.manipulator.Grab02
                    }
                    if (this.partThree.manipulator_Target1 != data.manipulator.Put01) {
                        this.partThree.manipulator_Target1 = data.manipulator.Put01
                    }
                    if (this.partThree.manipulator_Target2 != data.manipulator.Put02) {
                        this.partThree.manipulator_Target2 = data.manipulator.Put02
                    }
                    if (this.partThree.manipulator_Address != data.manipulator.Position) {
                        this.partThree.manipulator_Address = data.manipulator.Position
                    }
                    if (this.partFour.statusGroup1.RobotRestart != data.manipulator.RestartStatus) {
                        this.partFour.statusGroup1.RobotRestart = data.manipulator.RestartStatus
                    }
                }
            },
            // 数据定义处理函数
            getDataDefind(tag, value) {
                let result = "";
                switch (tag) {
                    case "工件来源": {
                        switch (value) {
                            case 0: {
                                result = "未知";
                                break;
                            }
                            case 1: {
                                result = "车床1";
                                break;
                            }
                            case 2: {
                                result = '缓存台1'
                                break;
                            }
                            case 3: {
                                result = "缓存台2"
                                break;
                            }
                            case 4: {
                                result = "车床2"
                                break;
                            }
                            case 5: {
                                result = '缓存台3'
                                break;
                            }
                            case 6: {
                                result = "缓存台4"
                                break;
                            }
                            case 7: {
                                result = "车床3"
                                break;
                            }
                            case 8: {
                                result = '缓存台5'
                                break;
                            }
                            case 9: {
                                result = "缓存台6"
                                break;
                            }
                            case 10: {
                                result = "三坐标测量"
                                break;
                            }
                            case 11: {
                                result = '扫码区'
                                break;
                            }
                            case 12: {
                                result = '打码区'
                                break;
                            }
                            case 13: {
                                result = '清洗机'
                                break;
                            }
                            default: {
                                result = '未知'
                                break;
                            }
                        }
                        break;
                    }
                    case "抓命令1": {
                        switch (value) {
                            case 0: {
                                result = "未知";
                                break;
                            }
                            default: {
                                result = "上料车No" + value;
                                break;
                            }
                        }
                        break;
                    }
                    case "抓命令2": {
                        switch (value) {
                            case 1: {
                                result = '车床1'
                                break;
                            }
                            case 2: {
                                result = '缓存台1'
                                break;
                            }
                            case 3: {
                                result = '缓存台2'
                                break;
                            }
                            case 4: {
                                result = '车床2'
                                break;
                            }
                            case 5: {
                                result = '缓存台3'
                                break;
                            }
                            case 6: {
                                result = '缓存台4'
                                break;
                            }
                            case 7: {
                                result = '车床3'
                                break;
                            }
                            case 8: {
                                result = '缓存台5'
                                break;
                            }
                            case 9: {
                                result = '缓存台6'
                                break;
                            }
                            case 10: {
                                result = '三坐标测量'
                                break;
                            }
                            case 11: {
                                result = '扫码区'
                                break;
                            }
                            case 12: {
                                result = '打码区'
                                break;
                            }
                            case 13: {
                                result = '清洗机'
                                break;
                            }
                            default: {
                                break;
                            }
                        }
                        break;
                    }
                    case "放命令1": {
                        switch (value) {
                            case 0: {
                                result = "未知";
                                break;
                            }
                            default: {
                                result = '下料车No' + value
                                break;
                            }
                        }
                        break;
                    }
                    case "放命令2": {
                        switch (value) {
                            case 1: {
                                result = '车床1'
                                break;
                            }
                            case 2: {
                                result = '缓存台1'
                                break;
                            }
                            case 3: {
                                result = '缓存台2'
                                break;
                            }
                            case 4: {
                                result = '车床2'
                                break;
                            }
                            case 5: {
                                result = '缓存台3'
                                break;
                            }
                            case 6: {
                                result = '缓存台4'
                                break;
                            }
                            case 7: {
                                result = '车床3'
                                break;
                            }
                            case 8: {
                                result = '缓存台5'
                                break;
                            }
                            case 9: {
                                result = '缓存台6'
                                break;
                            }
                            case 10: {
                                result = '三坐标测量'
                                break;
                            }
                            case 11: {
                                result = '扫码区'
                                break;
                            }
                            case 12: {
                                result = '打码区'
                                break;
                            }
                            case 13: {
                                result = '清洗机'
                                break;
                            }
                            default: {
                                break;
                            }
                        }
                        break;
                    }
                    case "位置": {
                        switch (value) {
                            case 1: {
                                result = '车床1'
                                break;
                            }
                            case 2: {
                                result = '缓存台1'
                                break;
                            }
                            case 3: {
                                result = '缓存台2'
                                break;
                            }
                            case 4: {
                                result = '车床2'
                                break;
                            }
                            case 5: {
                                result = '缓存台3'
                                break;
                            }
                            case 6: {
                                result = '缓存台4'
                                break;
                            }
                            case 7: {
                                result = '车床3'
                                break;
                            }
                            case 8: {
                                result = '缓存台5'
                                break;
                            }
                            case 9: {
                                result = '缓存台6'
                                break;
                            }
                            case 10: {
                                result = '三坐标测量'
                                break;
                            }
                            case 11: {
                                result = '车床1'
                                break;
                            }
                            case 12: {
                                result = '缓存台1'
                                break;
                            }
                            case 13: {
                                result = '缓存台2'
                                break;
                            }
                            case 14: {
                                result = '车床2'
                                break;
                            }
                            case 15: {
                                result = '缓存台3'
                                break;
                            }
                            case 16: {
                                result = '缓存台4'
                                break;
                            }
                            case 17: {
                                result = '车床3'
                                break;
                            }
                            case 18: {
                                result = '缓存台5'
                                break;
                            }
                            case 19: {
                                result = '缓存台6'
                                break;
                            }
                            case 20: {
                                result = '三坐标测量'
                                break;
                            }
                            case 30: {
                                result = '上料车'
                                break;
                            }
                            case 41: {
                                result = '成品车'
                                break;
                            }
                            case 42: {
                                result = 'NG车'
                                break;
                            }
                            case 51: {
                                result = '扫码区'
                                break;
                            }
                            case 52: {
                                result = '打码区'
                                break;
                            }
                            case 61: {
                                result = '扫码区'
                                break;
                            }
                            case 62: {
                                result = '打码区'
                                break;
                            }
                            case 71: {
                                result = '清洗机'
                                break;
                            }
                            case 72: {
                                result = '清洗机'
                                break;
                            }
                            default: {
                                break;
                            }
                        }
                        break;
                    }
                    default: {
                        break;
                    }
                }
                return result;
            },
            // 手动搬运工件
            transferMateril() {
                /**
                 * 做一些条件判断
                 * */
                console.log(this.transfer_from, this.transfer_to)
                if (this.transfer_from == '' || this.transfer_from == null) {
                    this.$message({
                        showClose: true,
                        duration:2000,
                        message: '提示：请选择搬运出发地',
                        type: 'info',
                        offset:80
                    })
                    return
                }
                if (this.transfer_to == '' || this.transfer_to == null) {
                    this.$message({
                        showClose: true,
                        duration: 2000,
                        message: '提示：请选择搬运目的地',
                        type: 'info',
                        offset:80
                    })
                    return
                }
                if (this.transfer_from == this.transfer_to) {
                    this.$message({
                        showClose: true,
                        duration: 2000,
                        message: '错误！ 搬运出发地与目的地相同',
                        type: 'error',
                        offset:80
                    })
                    return
                }
                let url = '@Url.Content("~/ShellManage/ShellBasic/TransferMateril")'
                axios.get(url, {
                    params: {
                        from: this.transfer_from,
                        to: this.transfer_to
                    }
                }).then(res => {
                    if (res.data.result) {
                        this.$message({
                            showClose: true,
                            duration: 2000,
                            message: '下发成功！',
                            type: 'success',
                            offset:80
                        })
                    } else {
                        this.$message({
                            showClose: true,
                            duration: 2000,
                            message: '下发失败！',
                            type: 'warning',
                            offset:80
                        })
                    }
                }).catch(err => {
                    this.$message({
                        showClose: true,
                        duration: 3000,
                        message: '错误！'+err,
                        type: 'error',
                        offset:80
                    })
                })
            },
            // 设置料车数量
            setCarNum(row) {
                let url = '@Url.Content("~/ShellManage/ShellBasic/SetCarNumber")'
                axios.get(url, {
                    params: {
                        carCode: row.info,
                        num: row.setNum
                    }
                }).then(res => {
                    if (res.data.result == true) {
                        this.$message({
                            showClose: true,
                            duration: 3000,
                            message: '设置成功！',
                            type: 'success',
                            offset: 80
                        })
                    } else {
                        this.$message({
                            showClose: true,
                            duration: 3000,
                            message: '错误！' + res.data.msg,
                            type: 'error',
                            offset: 80
                        })
                    }
                }).catch(err => {
                    this.$message({
                        showClose: true,
                        duration: 3000,
                        message: '错误！' + err,
                        type: 'error',
                        offset: 80
                    })
                })
            },
            // 获取kepware连接状态
            getConnectStatus() {
                let url = '@Url.Content("~/ShellManage/ShellBasic/GetConnectStatus")'
                axios.get(url).then(res => {
                    if (res.data.result != null) {
                        if (this.deviceStatus != res.data.result.IsConnected) {
                            this.deviceStatus = res.data.result.IsConnected;
                        }
                    } else {
                        if (this.deviceStatus != false) {
                            this.deviceStatus = false;
                        }
                    }
                }).catch(err => {
                    if (this.deviceStatus != false) {
                        this.deviceStatus = false;
                    }
                })
            }
        },
        mounted() {
            this.initData();
            this.trackData();
            this.getConnectStatus();
            setInterval(() => {
                this.getConnectStatus()
            }, 3500)
        }
    })
</script>

